//
//  BidListViewModel.swift
//  cxd4iphone
//
//  Created by hexy on 12/23/15.
//  Copyright © 2015 hexy. All rights reserved.
//

import UIKit
import ReactiveCocoa

class BuyListViewModel: BaseTableListViewModel {

    
    var bidViewModel: BidViewModel?
    
    func loadBidDetail(bidId: String) -> RACSignal {
        
        return RACSignal.createSignal({ (subscriber) -> RACDisposable! in
            
            
            
            APIManager.loadBidDetail(bidId).subscribeNext({ (result) -> Void in
                
//                                xx_JsonPrint(dict: result)
                let dict = result as! [String: AnyObject]
                self.bidViewModel = BidViewModel(bidModel: BidModel(dict: dict))
                
                subscriber.sendCompleted()
                
                }, error: { (error) -> Void in
                    
                    subscriber.sendError(error)
            })
            return RACDisposable(block: {})
        })
    }


}
